<?php

namespace Largezhou\Admin\Components\Tools;

/**
 * @method Back back()
 * @method Link link($text, $to, $type = 'default')
 * @method TableDelete tableDelete($action)
 * @method Refresh refresh()
 */
class ToolManager
{
    public function __call($name, $arguments)
    {
        $toolClassName = __NAMESPACE__.'\\'.ucfirst(camel_case($name));

        if (class_exists($toolClassName)) {
            return new $toolClassName(...$arguments);
        }

        throw new \ErrorException('Call to undefined method '.__CLASS__.'::'.$name.'()');
    }
}
